﻿@* 顶部导航分部视图 *@

@* 列表导航 开始 *@
<style>
	.alltop_nav .tnav .tlogo {
		padding-top: 12px;
	}
</style>
<div class="alltop_nav">
	<div class="tnav">
		<div class="tlogo">
			<a href="/">
				<img src="/Content/assets/img/index_logo.png" border="0">
			</a>
		</div>
		<div class="tl">
			<ul id="topNavUl" class="link_gray6 nowrap">
				<li class="nli J_hoverbut ">
					<a href="/" target="_self">首  页</a>
				</li>
				@* <li class="nli J_hoverbut select">  *@
				<li class="nli J_hoverbut">
					<a href="/jobs/list" target="_self">找工作</a>
				</li>
				<li class="nli J_hoverbut ">
					<a href="/talent/list" target="_self">招人才</a>
				</li>
				@*<li class="nli J_hoverbut ">
						<a href="/hrtools" target="_self">HR工具箱</a>
					</li>*@
				<li class="nli J_hoverbut ">
					<a href="/news" target="_self">职场资讯</a>
				</li>
				<li class="nli J_hoverbut ">
					<a href="/m" target="_self">会员中心</a>
				</li>
			</ul>
			<div class="clear"></div>
		</div>
		<div class="tr"></div>
		<div class="clear"></div>
	</div>
</div>
@* 列表导航 结束 *@

<script>
	$(function () {
		(function (window) {

			function getHrefConfig() {
				return {
					//0: [ //首页
					//	"/",
					//],
					1: [ //找工作
						'/jobs/list',
						'/jobs/show',
						'/jobs/company'
					],
					2: [ //招人才
						'/talent/list',
						'/talent/show'
					],
					//3: [ //HR工具箱
					//	'/hrtools',
					//	'/hrtools/list'
					//],
					3: [ //职场资讯
						'/news',
						'/news/list'
					],
					4: [ //会员中心
						'/m'
					]
				}
			}

			//获取url的pathname
			var pathname = location.pathname;
			var pathnameArr = yHelper.regex.getRegexArr(pathname, /((\/[a-z][_a-z0-9]*)+)/ig);
			if (pathnameArr.length <= 0) {
				yHelper.response.redirect("/");
				return;
			}
			pathname = pathnameArr[0];
			var hrefConfig = getHrefConfig();
			var configindex = -1;
			for (var key in hrefConfig) {
				var arr = hrefConfig[key];
				for (var m in arr) {
					if (arr[m] == pathname) {
						configindex = key;
						break;
					}
				}
				if (!!configindex && configindex >= 0) {
					break;
				}
			}
			if (!configindex || configindex < 0) {
				console.error("请在顶部导航分部视图中配置：" + pathname);
				return;
			}
			//激活样式
			var $theLi = $("#topNavUl").children(".nli").eq(configindex);
			$theLi.addClass("select");
			var href = $theLi.children("a").attr("href");
			if (pathname == href) {
				$theLi.children("a").attr("href", 'javascript:void(0)');
			}
		})(window)
	})
</script>